#ifndef GRAPH_H
#define GRAPH_H
#include <math.h>
class Shape
{
private:
    /* data */
protected:
     double area;
public:
    Shape(/* args */);
    ~Shape();
    virtual double getArea() =0;
};

Shape::Shape(/* args */)
{
}

Shape::~Shape()
{
}
class Circle :virtual public Shape
{
private:
    double r;
    /* data */
public:
    Circle (double inputR);
    ~Circle ();
    double getArea()
    {
        return area;
    }
};

Circle ::Circle (double inputR)
{
r=inputR;
area= M_PI*r*r;
}

Circle ::~Circle ()
{
}
class Rectangle  :virtual public Shape
{
private:
    double len;
    double wid;
public:
    Rectangle (double inputLen,double inputWid);
    ~Rectangle ();
    double getArea(){
        return area;
    }
};

Rectangle ::Rectangle (double inputLen,double inputWid)
{
    len=inputLen;
    wid=inputWid;
    area=len*wid;
}

Rectangle ::~Rectangle ()
{
}

class Square :public Rectangle
{
private:
    double edge;
public:
    Square(double inputA);
    ~Square();
};

Square::Square(double inputA) :Rectangle(inputA,inputA)
{
    edge=inputA;
}

Square::~Square()
{
}

class LadderShape :virtual public Shape
{
private:
    double height;
    double upEdge;
    double lowEdge;
public:
    LadderShape(double inputH,double inputUE,double inputLE);
    ~LadderShape();
    double getArea(){return area;};
};

LadderShape::LadderShape(double inputH,double inputUE,double inputLE)
{
    height=inputH;
    upEdge=inputUE;
    lowEdge=inputLE;
    area=height*(lowEdge+upEdge)/2.0;
}

LadderShape::~LadderShape()
{
}

#endif